<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {
		$('#form').form({
			url : '/equipmentDevSwingController/add',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}else{
					parent.$.messager.alert('提示',result.msg,'info');
				}
			}
		});
		parent.$.messager.progress('close');
		
		// 小区
		$.ajax({
			type:'post',
			url:'/residenceController/combobox',
			data:{},
			success:function(result) {
				$('#residenceId').combobox({
					data : result,
					valueField:'value',   
				    textField:'text',
				    panelHeight:'auto'
				});
			},
			dataType:'json'
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<table class="table table-hover table-condensed">
				<tr>
					<th>所属工控机</th>
					<td >
						<select id="parentDevId" name="parentDevId" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto',icons:[{iconCls:'icon-clear',handler: function(e){$(e.data.target).combobox('setValue','');}}]">
							<option value="">-- 请选择 --</option>
							<c:forEach items="${ipc}" var="ipc">
								<option value="${ipc.id}">${ipc.name}</option>
							</c:forEach>
						</select>
					</td>
					<th>所属小区</th>
					<td ><input name="residenceId" id="residenceId" class="span2 " /></td>
				</tr>
				<tr>
					<th>小区门名称</th>
					<td ><input name="doorName" id="doorName" class="span2 " /></td>
					<th>设备供应商</th>
					<td >
						<select id="equipmentProducerId" name="equipmentProducerId" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto',icons:[{iconCls:'icon-clear',handler: function(e){$(e.data.target).combobox('setValue','');}}]">
							<option value="">-- 请选择 --</option>
							<c:forEach items="${info}" var="info">
								<option value="${info.id}">${info.name}</option>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<th>设备名称</th>
					<td ><input name="name" id="name" class="span2 " /></td>
					<th>设备编号</th>
					<td ><input name="code" id="code" class="span2 " /></td>
				</tr>
				<tr>
					<th>设备位置</th>
					<td ><input name="address" id="address" class="span2 " /></td>
					<th>设备状态</th>
					<td >
						<select id="status" name="status" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto',icons:[{iconCls:'icon-clear',handler: function(e){$(e.data.target).combobox('setValue','');}}]">
							<option value="1">可用</option>
							<option value="2">不可用</option>
							<option value="3">暂停</option>
						</select>
					</td>
				</tr>
				<tr>
					<th>内部IP</th>
					<td ><input name="localIp" id="localIp" class="span2 " /></td>
					<th>内部端口</th>
					<td ><input name="localPort" id="localPort" class="span2 " /></td>
				</tr>
			</table>
		</form>
	</div>
</div>